/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frhashmap_varfield.h                               */
/*  NOTE      =                                                    */
/*  DATE      = 2014/12/22 by geyh                                 */
/*******************************************************************/

#ifndef __FRHASHMAP_VARFIELD_H_
#define __FRHASHMAP_VARFIELD_H_

#include "frlist.h"

typedef struct __st_hashmap {
    unsigned long   ul_hash_size;        /* 数组长度 */
    Frlist_header  *p_list_array;

} Frhashmap_header;

int frhashmap_varfield_create(Frhashmap_header *p_hash_hdr, unsigned long ul_hash_size);
Frhashmap_header *frhashmap_varfield_create2(unsigned long ul_hash_size);
void frhashmap_varfield_free(Frhashmap_header *p_hash_hdr);
void frhashmap_varfield_free2(Frhashmap_header *p_hash_hdr);

//i_loop循环用变量,p_hash_hdr hash表指针, p_lst_hdr_tmp链表用临时变量
#define FRHASHMAP_LOOP(i_loop,p_hash_hdr, p_lst_hdr_tmp)  \
        for(i_loop=0; i_loop < (p_hash_hdr)->ul_hash_size && (p_lst_hdr_tmp = &((p_hash_hdr)->p_list_array[i_loop]) ); i_loop++)

int frhashmap_varfield_add(Frhashmap_header *p_hash_hdr, Frvar_field *p_st_field);
Frvar_field *frhashmap_varfield_get(Frhashmap_header *p_hash_hdr, char *p_name);
int frhashmap_varfield_del(Frhashmap_header *p_hash_hdr, char *p_name);

void frhashmap_varfield_output(Frhashmap_header *p_hash_hdr, char **pp_outbuff);

#endif
